{{include template('public/header','admin')}}
<script src="{{STATIC_URL}}/plugins/colorpicker.js"></script>
<style>
    .title{
        width:483px;background: url(/static/admin/ruler.gif) repeat-x scroll 0 19px transparent;
    }
</style>
</head>
<body>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <div class="page-header">
                    <h3>{{$action}}{{$modelname}}</h3>
                </div>
                <style> .validform input {width: 60%;float: left;}</style>
                <form action="{{url($postUrl)}}" method="post" class="form-horizontal validform" id="cpform" name="cpform" role="form" autocomplete='off' >
                    <input type="hidden" name="formhash" value="{{FORMHASH}}" />
                    <input type="hidden" id="formscrolltop" name="scrolltop" value="" />
                    <input type="hidden" name="anchor" value="luomingui" />
                    <input type='hidden' name='contentid' value="{{$item['contentid']}}" />
                    <input type='hidden' name='modelid' value="{{$modelid}}" />
                    <input type='hidden' name='tablename' value="{{$tablename}}" />
                    <input type='hidden' name='action' value="{{$action}}" />
                    <input type="hidden"  value="{{$item['sort']}}"  name="sort">
                    <table class="table table-border ticky_table">
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_catid')}}：</td>
                            <td> {{select_category('catid', ticky\request::get('catid', 0), '', 0, '', true, true, ticky\request::get('modelid', 0))}}</td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_title')}}：</td>
                            <td><input type="text" id="title" name='title' value="{{$item.title}}" maxlength="255" tabindex="5" class='title form-control 'style="width:787px;" datatype="*" nullmsg="请输入{{L('content_title')}}" errormsg="请输入{{L('content_title')}}"  placeholder="请输入{{L('content_title')}}"/>
                                <input type="hidden" name="style_color" id="style_color" value="">
                                <input type="hidden" name="style_font_weight" id="style_font_weight" value="">
                                <img src="/static/admin/icon/colour.png" width="15" height="16" onclick="colorpicker('title_colorpanel', 'set_title_color');" style="cursor:hand;"/>
                                <img src="/static/admin/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand;"/>
                                <span id="title_colorpanel" style="position:absolute; z-index:200" class="colorpanel"></span>
                            </td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_flag')}}：</td>
                            <td>
                                <div>
                                    <label class="option_label">置顶[1] <input name="flag[]" type="checkbox" value="1" {{if strpos($item['flag'], '1') != false }}checked{{/if}} onclick="set_top()" id="settop"/></label>&nbsp;&nbsp;
                                    <label class="option_label">头条[2] <input name="flag[]" type="checkbox" value="2" {{if strpos($item['flag'], '2') != false }}checked{{/if}}/></label>&nbsp;&nbsp;
                                    <label class="option_label">特荐[3] <input name="flag[]" type="checkbox" value="3" {{if strpos($item['flag'], '3') != false }}checked{{/if}}/></label>&nbsp;&nbsp;
                                    <label class="option_label">推荐[4] <input name="flag[]" type="checkbox" value="4" {{if strpos($item['flag'], '4') != false }}checked{{/if}}/></label>&nbsp;&nbsp;
                                    <label class="option_label">热点[5] <input name="flag[]" type="checkbox" value="5" {{if strpos($item['flag'], '5') != false }}checked{{/if}}/></label>&nbsp;&nbsp;
                                    <label class="option_label">幻灯[6] <input name="flag[]" type="checkbox" value="6" {{if strpos($item['flag'], '6') != false }}checked{{/if}}/></label>&nbsp;&nbsp;
                                    <label class="option_label">跳转[7] <input name="flag[]" type="checkbox" value="6" {{if strpos($item['flag'], '7') != false }}checked{{/if}} onclick="toggle()" /></label>&nbsp;&nbsp;
                                </div>
                            </td>
                        </tr>
                        <tr style="display:none;" id="url">
                            <td class="w_100">{{L('content_url')}}：</td>
                            <td><input type="text" id="url" name='url' value="{{$item.url}}"  class='form-control' tabindex="8"  placeholder="请输入{{L('content_url')}}" />
                            </td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_description')}}：</td>
                            <td>
                                <textarea  id="description" name='description' class="form-control"  rows="3" maxlength="255" tabindex="7" datatype="*" nullmsg="请输入{{L('content_description')}}" errormsg="请输入{{L('content_description')}}"  placeholder="请输入{{L('content_description')}}">{{$item.description}}</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_thumb')}}：</td>
                            <td>  {{form::image('thumb', $item.thumb, 'width:370px', true)}}
                                <img src="{{$item.thumb}}" class="thumb hidden" id="thumb_src" alt="缩 略 图" />
                            </td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_tag')}}：</td>
                            <td><input type="text" id="tag" name='tag' value="{{$item.tag}}"  class='form-control' tabindex="11" datatype="*" nullmsg="请输入{{L('content_tag')}}！" errormsg="{{L('content_tag')}}错误,请重新输入！" placeholder="请输入{{L('content_tag')}}" />
                            </td>
                        </tr>
                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_readperm')}}：</td>
                            <td>
                                {{showselectusergroup($item.readperm,'readperm')}}
                                <input type="text" id="readpoint" name='readpoint' value="{{$item.readpoint}}"  class='form-control' tabindex="17" datatype="*" nullmsg="请输入{{L('content_readpoint')}}！" errormsg="{{L('content_readpoint')}}错误,请重新输入！" placeholder="请输入{{L('content_readpoint')}}" style="width: 53%;"/>
                            </td>
                        </tr>

                        <tr>
                            <td class="w_100"> <span class="red">*</span>{{L('content_allowcomment')}}：</td>
                            <td class="form-inline">
                                <label class="option_label">是<input style=" width: 10px;" type="radio" name="allowcomment"  id="allowcomment1" value="1"  {{if $item["allowcomment"] eq '1'}}checked{{/if}}  ></label>&nbsp;&nbsp;
                                <label class="option_label">否<input style=" width: 10px;"type="radio" name="allowcomment" id="allowcomment2"  value="0" {{if $item["allowcomment"] eq '0'}}checked{{/if}} ></label>&nbsp;&nbsp;
                            </td>
                        </tr>


                        {{$from}}

                        <tr><td></td><td><input type="submit" name="dosubmit" class="btn btn-primary" value="{{L('submit')}}" style="width: 54px;" /></td></tr>
                    </table>
                    <script type="text/javascript">
                        $(function () {
                            $(".validform").Validform({tiptype: 3, showAllError: true, ajaxPost: true,
                                callback: function (ret) {
                                    if (ret.status == "y") {
                                        parent.location.reload();
                                    } else {
                                        layer.msg(ret.info);
                                    }
                                }
                            });
                        });
                    </script>
                </form>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function set_title_color(color) {
            $('#title').css('color', color);
            $('#style_color').val(color);
        }
        function input_font_bold() {
            if ($('#title').css('font-weight') == '700' || $('#title').css('font-weight') == 'bold') {
                $('#title').css('font-weight', 'normal');
                $('#style_font_weight').val('');
            } else {
                $('#title').css('font-weight', 'bold');
                $('#style_font_weight').val('bold');
            }
        }
        function set_top() {
            if ($('#settop').get(0).checked) {
                $("input[name='sort']").val('1');
            } else {
                $("input[name='sort']").val('10');
            }
        }
        function set_status(s) {
            $("input[name='status']").val(s);
        }
        function toggle() {
            $("#url").toggle();
        }
    </script>
</body>
</html>